
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.PubChatCancelKFMessage2 = exports.PubChatCancelKFMessage = exports.PubChatCancelMessage2 = exports.PubChatCancelMessage = exports.GroupChatCancelMessage = exports.ChatCancelMessage2 = exports.ChatCancelMessage = void 0;
var long_1 = __webpack_require__(/*! _util/long */ "./src/core/utils/long.ts");
var constant_1 = __webpack_require__(/*! _util/constant */ "./src/core/utils/constant.ts");
var sessionIdProcessor_1 = __webpack_require__(/*! _Eutils/sessionIdProcessor */ "./src/extra/utils/sessionIdProcessor.ts");
var CancelMessage = /** @class */ (function () {
    function CancelMessage(_a) {
        var _b = _a.appId, appId = _b === void 0 ? 0 : _b, _c = _a.deviceType, deviceType = _c === void 0 ? 0 : _c, _d = _a.belongTo, belongTo = _d === void 0 ? '' : _d, _e = _a.from, from = _e === void 0 ? '' : _e, _f = _a.to, to = _f === void 0 ? '' : _f, _g = _a.fromName, fromName = _g === void 0 ? '' : _g, _h = _a.toAppId, toAppId = _h === void 0 ? 0 : _h, _j = _a.extension, extension = _j === void 0 ? '' : _j, _k = _a.channelId, channelId = _k === void 0 ? 0 : _k, _l = _a.isForce, isForce = _l === void 0 ? false : _l, _m = _a.time, time = _m === void 0 ? 0 : _m, _o = _a.uuid, uuid = _o === void 0 ? '' : _o, _p = _a.mid, mid = _p === void 0 ? '' : _p, _q = _a.direction, direction = _q === void 0 ? 1 : _q, sid = _a.sid;
        this.isCancel = true;
        this.sessionId = '';
        this.appId = 0;
        this.deviceType = 0;
        this.sessionType = '';
        this.belongTo = '';
        this.from = '';
        this.to = '';
        this.fromName = '';
        this.toAppId = 0;
        this.extension = '';
        this.channelId = 0;
        this.isForce = false;
        this.status = constant_1.CANCEL_STATUS.DEFAULT;
        this.time = 0;
        this.mid = '';
        this.uuid = '';
        this.svrTime = 0;
        this.isTTMessage = false;
        this.pubId = '';
        this.peerUid = '';
        this.sendCode = 0;
        this.originMessage = null; // 当收到撤回消息的时候，假如有原始消息则这里会有值
        this.direction = 1; // 1表示发送的消息，2表示接收到消息。 此字段只有在pub会话时才能用
        this.appId = appId;
        this.deviceType = deviceType;
        this.belongTo = belongTo;
        this.from = from;
        this.to = to;
        this.fromName = fromName;
        this.toAppId = toAppId;
        this.extension = extension;
        this.channelId = channelId;
        this.isForce = isForce;
        this.status = constant_1.CANCEL_STATUS.CANCELED;
        this.time = time;
        this.mid = mid;
        this.uuid = uuid;
        this.svrTime = mid ? (long_1.default.fromString(mid).shiftRight(22).toNumber() + 1361753741828) : 0;
        this.sid = sid;
        this.direction = direction;
        this.sessionId = sessionIdProcessor_1.default.create({ channelId: this.channelId, uid: this.belongTo, sid: this.sid });
    }
    CancelMessage.prototype.setMid = function (msgId) {
        var mid = msgId.toString ? msgId.toString() : msgId;
        this.mid = mid;
        this.svrTime = mid ? (long_1.default.fromString(mid).shiftRight(22).toNumber() + 1361753741828) : 0;
    };
    CancelMessage.prototype.isChatMessage = function () {
        return this.sessionType === constant_1.SESSION_TYPE.CHAT;
    };
    CancelMessage.prototype.isChatMessage2 = function () {
        return this.sessionType === constant_1.SESSION_TYPE.CHAT2;
    };
    CancelMessage.prototype.isGroupChatMessage = function () {
        return this.sessionType === constant_1.SESSION_TYPE.GROUP_CHAT;
    };
    CancelMessage.prototype.isPubChatMessage = function () {
        return this.sessionType === constant_1.SESSION_TYPE.PUB_CHAT;
    };
    CancelMessage.prototype.isPubChatMessage2 = function () {
        return this.sessionType === constant_1.SESSION_TYPE.PUB_CHAT2;
    };
    CancelMessage.prototype.isCSChatMessage = function () {
        return this.sessionType === constant_1.SESSION_TYPE.CS_CHAT;
    };
    CancelMessage.prototype.isCSChatMessage2 = function () {
        return this.sessionType === constant_1.SESSION_TYPE.CS_CHAT2;
    };
    CancelMessage.prototype.toString = function () {
        return ' isCancel:' + this.isCancel
            + ' sessionId:' + this.sessionId
            + ' appId:' + this.appId
            + ' deviceType:' + this.deviceType
            + ' sessionType:' + this.sessionType
            + ' belongTo:' + this.belongTo
            + ' from:' + this.from
            + ' to:' + this.to
            + ' toAppId:' + this.toAppId
            + ' extension:' + this.extension
            + ' channelId:' + this.channelId
            + ' isForce:' + this.isForce
            + ' status:' + this.status
            + ' time:' + this.time
            + ' mid:' + this.mid
            + ' uuid:' + this.uuid
            + ' svrTime:' + this.svrTime
            + ' isTTMessage:' + this.isTTMessage
            + ' pubId:' + this.pubId
            + ' peerUid:' + this.peerUid
            + ' sid:' + this.sid;
    };
    return CancelMessage;
}());
var ChatCancelMessage = /** @class */ (function (_super) {
    __extends(ChatCancelMessage, _super);
    function ChatCancelMessage(messageDatum) {
        var _this = _super.call(this, messageDatum) || this;
        _this.sessionType = constant_1.SESSION_TYPE.CHAT;
        return _this;
    }
    return ChatCancelMessage;
}(CancelMessage));
exports.ChatCancelMessage = ChatCancelMessage;
var ChatCancelMessage2 = /** @class */ (function (_super) {
    __extends(ChatCancelMessage2, _super);
    function ChatCancelMessage2(messageDatum) {
        var _this = _super.call(this, messageDatum) || this;
        _this.sessionType = constant_1.SESSION_TYPE.CHAT2;
        return _this;
    }
    return ChatCancelMessage2;
}(CancelMessage));
exports.ChatCancelMessage2 = ChatCancelMessage2;
var GroupChatCancelMessage = /** @class */ (function (_super) {
    __extends(GroupChatCancelMessage, _super);
    function GroupChatCancelMessage(messageDatum) {
        var _this = _super.call(this, messageDatum) || this;
        _this.groupName = '';
        _this.adminUid = '';
        _this.groupName = messageDatum.groupName || '';
        _this.sessionType = constant_1.SESSION_TYPE.GROUP_CHAT;
        _this.adminUid = messageDatum.adminUid !== void 0 ? messageDatum.adminUid : 0;
        return _this;
    }
    return GroupChatCancelMessage;
}(CancelMessage));
exports.GroupChatCancelMessage = GroupChatCancelMessage;
var PubChatCancelMessage = /** @class */ (function (_super) {
    __extends(PubChatCancelMessage, _super);
    function PubChatCancelMessage(messageDatum) {
        var _this = _super.call(this, messageDatum) || this;
        _this.direction = '';
        _this.direction = messageDatum.direction;
        _this.sessionType = constant_1.SESSION_TYPE.PUB_CHAT;
        return _this;
    }
    return PubChatCancelMessage;
}(CancelMessage));
exports.PubChatCancelMessage = PubChatCancelMessage;
var PubChatCancelMessage2 = /** @class */ (function (_super) {
    __extends(PubChatCancelMessage2, _super);
    function PubChatCancelMessage2(messageDatum) {
        var _this = _super.call(this, messageDatum) || this;
        _this.direction = '';
        _this.direction = messageDatum.direction;
        _this.sessionType = constant_1.SESSION_TYPE.PUB_CHAT2;
        return _this;
    }
    return PubChatCancelMessage2;
}(CancelMessage));
exports.PubChatCancelMessage2 = PubChatCancelMessage2;
var PubChatCancelKFMessage = /** @class */ (function (_super) {
    __extends(PubChatCancelKFMessage, _super);
    function PubChatCancelKFMessage(messageDatum) {
        var _this = _super.call(this, messageDatum) || this;
        _this.direction = '';
        _this.direction = messageDatum.direction;
        _this.sessionType = constant_1.SESSION_TYPE.CS_CHAT;
        _this.pubId = messageDatum.pubId;
        _this.peerUid = messageDatum.peerUid;
        return _this;
    }
    return PubChatCancelKFMessage;
}(CancelMessage));
exports.PubChatCancelKFMessage = PubChatCancelKFMessage;
var PubChatCancelKFMessage2 = /** @class */ (function (_super) {
    __extends(PubChatCancelKFMessage2, _super);
    function PubChatCancelKFMessage2(messageDatum) {
        var _this = _super.call(this, messageDatum) || this;
        _this.direction = '';
        _this.direction = messageDatum.direction;
        _this.sessionType = constant_1.SESSION_TYPE.CS_CHAT2;
        _this.pubId = messageDatum.pubId;
        _this.peerUid = messageDatum.peerUid;
        return _this;
    }
    return PubChatCancelKFMessage2;
}(CancelMessage));
exports.PubChatCancelKFMessage2 = PubChatCancelKFMessage2;


//# sourceURL=webpack://MTDX/./src/extra/models/cancel-message.ts?